package com.chaochis.springboottestdemo.config.webConfig;


import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class WebContext implements ApplicationContextAware {

  private static ApplicationContext webContext = null;

  public static ApplicationContext getApplicationContext() {
    return webContext;
  }

  @Override
  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    if(WebContext.webContext == null){
      WebContext.webContext  = applicationContext;
    }
  }

}
